package com.exadel.Intlsit;

import java.awt.peer.SystemTrayPeer;
import java.io.Console;
import java.util.ArrayList;

public class App 
{
	public static void timeToAdd(int count){

		IntList Int = new IntList();
    	ArrayList<Integer> arr = new ArrayList<Integer>();
		long start = 0;
    	long trim = 0;
    	
		//addition in ArrayList
    	start = System.currentTimeMillis();
    	for(int i=0;i<count;i++){
    		arr.add(100);
    	}
    	trim = System.currentTimeMillis();
		trim = trim - start;
		System.out.println("add in ArrayList complete    |"+ trim);
		
		//additon in IntList
    	start = System.currentTimeMillis();
    	for(int i=0;i<count;i++){
    		Int.add(100);
    	}
    	trim = System.currentTimeMillis();
		trim = trim - start;
		System.out.println("add in IntList complete      |"+ trim);
	}
	public static void timeToInsert(int count){
		IntList Int = new IntList();
    	ArrayList<Integer> arr = new ArrayList<Integer>();
		long start = 0;
    	long trim = 0;
    	arr.add(100);
    	
    	//insertion in ArrayList
    	start = System.currentTimeMillis();
    	for(int i=0;i<count;i++){
    		arr.add(1,100);
    	}
    	
    	trim = System.currentTimeMillis();
		trim = trim - start;
		System.out.println("insert in ArrayList complete |"+ trim);
		
		//insertion in IntList
		Int.add(100);
    	start = System.currentTimeMillis();
    	for(int i=0;i<count;i++){
    		Int.insert(1,100);
    	}
    	trim = System.currentTimeMillis();
		trim = trim - start;
		System.out.println("insert in IntList complete   |"+ trim);
	}
	public static void timeToRemove(int count){
		IntList Int = new IntList();
    	ArrayList<Integer> arr = new ArrayList<Integer>();
		long start = 0;
    	long trim = 0;
    	for(int i=0;i<count+2;i++){
    		arr.add(100);
    		Int.add(100);
    		}
    	//remove in ArrayList
    	start = System.currentTimeMillis();
    	for(int i=0;i<count;i++){
    		arr.remove(1);
    	}
    	trim = System.currentTimeMillis();
		trim = trim - start;
		System.out.println("remove in ArrayList complete |"+ trim);
		
		
		//remove in IntList
    	start = System.currentTimeMillis();
    	for(int i=0;i<count;i++){
    		Int.remove(1);
    	}
    	trim = System.currentTimeMillis();
		trim = trim - start;
		System.out.println("remove in IntList complete   |"+ trim);
    	
	}
	public static void timeToGet(int count){
		IntList Int = new IntList();
    	ArrayList<Integer> arr = new ArrayList<Integer>();
		long start = 0;
    	long trim = 0;
    	for(int i=0;i<count+2;i++){
    		arr.add(100);
    		Int.add(100);
    	}
		//get in ArrayList
    	start = System.currentTimeMillis();
    	for(int i=0;i<count;i++){
    		arr.get(0);
    	}
    	trim = System.currentTimeMillis();
		trim = trim - start;
		System.out.println("get in ArrayList complete    |"+ trim);
		
		//get in ArrayList
    	start = System.currentTimeMillis();
    	for(int i=0;i<count;i++){
    		Int.get(0);
    	}
    	trim = System.currentTimeMillis();
		trim = trim - start;
		System.out.println("get in IntList complete      |"+ trim);
	}
	public static void main( String[] args )
    {
		System.out.println("_____________________________|___");
    int count = 15000;
    	timeToAdd(count);
    	timeToInsert(count);
    	timeToRemove(count);
    	timeToGet(count);
    	
    	
		
		
		
		
		
		
    }
}
